﻿using System;

namespace EverBuy.SocialNetworking.Data.EntityFrameworkRepository.ModelMapper
{
    /// <summary>
    /// 
    /// </summary>
    public class Mapper
    {
        /// <summary>
        /// 
        /// </summary>
        /// <param name="account"></param>
        /// <returns></returns>
        internal static BusinessObjects.Account Map(DataModel.Account account)
        {
            return new BusinessObjects.Account
            {
                ID = account.AccountID,
                FirstName = account.FirstName,
                LastName = account.LastName,
                Email = account.Email,
                EmailVerified = account.EmailVerified,
                Zip = account.Zip,
                Username = account.Username,
                Password = account.Password,
                BirthDate = Convert.ToDateTime(account.BirthDate),
                CreateDate = Convert.ToDateTime(account.CreateDate),
                LastUpdateDate = Convert.ToDateTime(account.LastUpdateDate),
                Timestamp = account.TimeStamp,
                //TermID = account.TermID,
                AgreedToTermsDate = Convert.ToDateTime(account.AgreedToTermsDate),
            };
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="account"></param>
        /// <returns></returns>
        internal static DataModel.Account Map(BusinessObjects.Account account)
        {
            return new DataModel.Account
            {
                AccountID = account.ID,
                FirstName = account.FirstName,
                LastName = account.LastName,
                Email = account.Email,
                EmailVerified = account.EmailVerified,
                Zip = account.Zip,
                Username = account.Username,
                Password = account.Password,
                BirthDate = Convert.ToDateTime(account.BirthDate),
                CreateDate = Convert.ToDateTime(account.CreateDate),
                LastUpdateDate = Convert.ToDateTime(account.LastUpdateDate),
                TimeStamp = account.Timestamp,
                //Term.TermID = account.TermID,
                AgreedToTermsDate = Convert.ToDateTime(account.AgreedToTermsDate),
            };
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="accountPermission"></param>
        /// <returns></returns>
        internal static BusinessObjects.AccountPermission Map(DataModel.AccountPermission accountPermission)
        {
            return new BusinessObjects.AccountPermission
                       {
                           //AccountID =  accountPermission..AccountID,
                           //PermissionID =  accountPermission.PermissionID,
                           AccountPermissionID = accountPermission.AccountPermissionID,
                           Timestamp = accountPermission.TimeStamp
                       };
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="accountPermission"></param>
        /// <returns></returns>
        internal static DataModel.AccountPermission Map(BusinessObjects.AccountPermission accountPermission)
        {
            return new DataModel.AccountPermission
            {
                //AccountID = accountPermission.AccountID,
                //PermissionID = accountPermission.PermissionID,
                AccountPermissionID = accountPermission.AccountPermissionID,
                TimeStamp = accountPermission.Timestamp
            };
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="permission"></param>
        /// <returns></returns>
        internal static BusinessObjects.Permission Map(DataModel.Permission permission)
        {
            return new BusinessObjects.Permission
                       {
                           PermissionID = permission.PermissionID,
                           Name = permission.Name,
                           Timestamp = permission.TimeStamp
                       };
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="permission"></param>
        /// <returns></returns>
        internal static DataModel.Permission Map(BusinessObjects.Permission permission)
        {
            return new DataModel.Permission
            {
                PermissionID = permission.PermissionID,
                Name = permission.Name,
                TimeStamp = permission.Timestamp
            };
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="term"></param>
        /// <returns></returns>
        internal static  BusinessObjects.Term Map (DataModel.Term term)
        {
            return new BusinessObjects.Term
                       {
                           TermID = term.TermID,
                           Terms = term.Terms,
                           Timestamp = term.TimeStamp,
                           CreateDate = term.CreateDate
                       };
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="term"></param>
        /// <returns></returns>
        internal static DataModel.Term Map(BusinessObjects.Term term)
        {
            return new DataModel.Term
            {
                TermID = term.TermID,
                Terms = term.Terms,
                TimeStamp = term.Timestamp,
                CreateDate = term.CreateDate
            };
        }
    }
}
